package com.ljn.core.dto.common.utils.assmbler;

import com.ljn.core.dto.Enterprise;
import com.ljn.core.dto.common.User;
import com.ljn.core.dto.common.command.usercommand.Registercommand;
import org.springframework.beans.BeanUtils;

/**
 * Created by 55966005 on 2017/11/3.
 */
public class EnterpriseAssmbler{
    public static Enterprise toEnterprise(Registercommand registerCommand) {
        Enterprise enterprise = new Enterprise();
        BeanUtils.copyProperties(registerCommand, enterprise);
        return enterprise;
    }

    public static Enterprise getEnterprise(User user, Enterprise enterprise) {
        enterprise.setName(user.getName());
        enterprise.setUserName(user.getUserName());
        enterprise.setPhone(user.getPhone());
        enterprise.setPassword(user.getPassword());
        enterprise.setType(user.getType());
        enterprise.setEmail(user.getEmail());
        enterprise.setPotrait(user.getPotrait());
        enterprise.setCreateTime(user.getCreateTime());
        enterprise.setUpdateTime(user.getUpdateTime());
        return enterprise;
    }

}
